class Solution(object):
    def removeElement(self, nums, val):
        """
        :type nums: List[int]
        :type val: int
        :rtype: int
        """
        slow=0

        if not nums:
            return 0
        for i in range(len(nums)):
            if nums[i]!=val:
                nums[slow]=nums[i]
                slow+=1
        count = slow  # 元素个数
        result = nums[:count]  # 处理后的数组

        return count
solution=Solution()
nums=[3,2,2,3]
val=3
k=solution.removeElement(nums,val)
print(k)
print(nums)

